import { reqGetSearchList } from "@/api"
const state = {
    searchList: {}
}
const mutations = {
    GETSEARCH(state, searchList) {
        state.searchList = searchList
    }
}
const actions = {
        async getSearchInfo({ commit }, params = {}) {
            let res = await reqGetSearchList(params)
            if (res.code === 200) {
                commit('GETSEARCH', res.data)
            }
        }
    }
    // 使用getters计算属性来简化数据
const getters = {
    attrsList(state) {
        // 加入得不到请求，则返回空数组
        return state.searchList.attrsList || {}
    },
    goodsList(state) {
        return state.searchList.goodsList || {}
    },
    trademarkList(state) {
        return state.searchList.trademarkList || {}
    }
}
export default {
    state,
    mutations,
    actions,
    getters
}